<?php
session_start();

$datas['state'] = 0;// -1:异常 0: 正常

$qaptchaid= $_POST['qaptchaid'];// 标识ID
$generatepass = $_POST['generatepass'];// 验证码

$datas['qaptchaid'] = $qaptchaid; // 标识ID
$datas['generatepass'] = $generatepass; // 验证码

// 判断有没有验证码
if(isset($qaptchaid) && isset($generatepass)){
  $_SESSION[$qaptchaid] = $datas['generatepass'];//验证码保存
} else {
  $datas['state'] = -1;
}

echo json_encode($datas);